import request from '@/utils/request'

export function getcategory(page, keyword, page_size) {
  return request({
    url: '/admin/category',
    method: 'get',
    params: { page, keyword, page_size }
  })
}

export function postnewcategory(subject_name) {
  return request({
    url: '/admin/category',
    method: 'post',
    data: {
      subject_name
    }
  })
}

export function deletecategory(id) {
  return request({
    url: '/admin/category',
    method: 'delete',
    params: { id }
  })
}

export function patchcategory(id, subject_name) {
  return request({
    url: '/admin/category',
    method: 'patch',
    data: {
      id,
      subject_name
    }
  })
}

export function getcourse(page, keyword, page_size, search_type) {
  return request({
    url: '/admin/course',
    method: 'get',
    params: { page, keyword, page_size, search_type }
  })
}

export function postcourse(data) {
  return request({
    url: '/admin/course',
    method: 'post',
    data: data
  })
}

export function patchcourse(data) {
  return request({
    url: '/admin/course',
    method: 'patch',
    data: data
  })
}

export function deletecourse(id) {
  return request({
    url: '/admin/course',
    method: 'delete',
    params: { id }
  })
}

export function getteacher(page, keyword, page_size, search_type) {
  return request({
    url: '/admin/teacher',
    method: 'get',
    params: { page, keyword, page_size, search_type }
  })
}

export function postteacher(data) {
  return request({
    url: '/admin/teacher',
    method: 'post',
    data: data
  })
}

export function patchteacher(data) {
  return request({
    url: '/admin/teacher',
    method: 'patch',
    data: data
  })
}

export function deleteteacher(id) {
  return request({
    url: '/admin/teacher',
    method: 'delete',
    params: { id }
  })
}

export function getlession(course_id) {
  return request({
    url: '/admin/lession',
    method: 'get',
    params: { course_id }
  })
}

export function postlession(data) {
  return request({
    url: '/admin/lession',
    method: 'post',
    data: data
  })
}

export function deletelession(id) {
  return request({
    url: '/admin/lession',
    method: 'delete',
    params: { id }
  })
}

export function patchlession(data) {
  return request({
    url: '/admin/lession',
    method: 'patch',
    data: data
  })
}

export function getgroup() {
  return request({
    url: '/admin/group',
    method: 'get'
  })
}

export function getuser(page, keyword, page_size, search_type) {
  return request({
    url: '/admin/user',
    method: 'get',
    params: { page, keyword, page_size, search_type }
  })
}

export function postuser(data) {
  return request({
    url: '/admin/user',
    method: 'post',
    data: data
  })
}

export function patchuser(data) {
  return request({
    url: '/admin/user',
    method: 'patch',
    data: data
  })
}

export function deleteuser(id) {
  return request({
    url: '/admin/user',
    method: 'delete',
    params: { id }
  })
}

export function postimage(data) {
  return request({
    url: '/admin/file',
    method: 'post',
    data: data
  })
}

export function getselectleeion(page, keyword, page_size, search_type, course_id) {
  return request({
    url: '/admin/selectlession',
    method: 'get',
    params: { page, keyword, page_size, search_type, course_id }
  })
}

export function postselectleeion(data) {
  return request({
    url: '/admin/selectlession',
    method: 'post',
    data: data
  })
}

export function deleteselectleeion(id) {
  return request({
    url: '/admin/selectlession',
    method: 'delete',
    params: { id }
  })
}

export function patchselectleeion(data) {
  return request({
    url: '/admin/selectlession',
    method: 'patch',
    data: data
  })
}

export function getzoomurl(lession_id) {
  return request({
    url: '/admin/zoomvideo',
    method: 'get',
    params: { lession_id }
  })
}


// courseusergroup
export function patchcourseusergroup(form_data,group_num) {
  return request({
      url: '/admin/changegroup',
      method: 'patch',
      data: {
        form_data:form_data,
        group_num:group_num
      }
  })
}